"""cucmarket URL Configuration
cucmarket URL Configuration



This configuration includes:
- Admin site at 'admin/'.
- Goods app URLs at the root ('').
- User app URLs at 'user/'.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include, re_path  # 使用 path 和 include
from django.conf import settings
from django.conf.urls.static import static


# 加入下面的return_static函数
from django.contrib.staticfiles.views import serve
def return_static(request, path, insecure=True, **kwargs):
  return serve(request, path, insecure, **kwargs)


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('goods.urls')),
    path('user/', include('user.urls')),
    path('chat/', include('chat.urls')),
    #path('accounts/', include('django.contrib.auth.urls')),  # 添加这一行
    re_path(r'^static/(?P<path>.*)$', return_static, name='static'), # 添加这行
]
# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
